﻿<UserControl x:Class="Kokomo.PeInspector.DialogTemplateView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:r="clr-namespace:Kokomo.Mirror.PeFormat.Resources;assembly=Kokomo.Mirror"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
	<Grid>
		<Border
			Width="{Binding DialogTemplate.Width}"
			Height="{Binding DialogTemplate.Height}"
			Background="Silver"
			>
			<ItemsControl
				ItemsSource="{Binding DialogTemplate.Items}"
				>
				<ItemsControl.ItemsPanel>
					<ItemsPanelTemplate>
						<Canvas IsItemsHost="True"/>
					</ItemsPanelTemplate>
				</ItemsControl.ItemsPanel>
				
				<ItemsControl.ItemTemplate>
					<DataTemplate DataType="{x:Type r:DialogItemTemplate}">
						<ContentPresenter
							Content="{Binding}"
							Canvas.Top="{Binding Top}"
							Canvas.Left="{Binding Left}"
							Width="{Binding Width}"
							Height="{Binding Height}"
							>
							<ContentPresenter.Style>
								<Style TargetType="{x:Type ContentPresenter}">
									<Style.Triggers>
										<DataTrigger Binding="{Binding ItemType}" Value="{x:Static Member=r:DialogItemType.Button}">
											<Setter Property="ContentTemplate">
												<Setter.Value>
													<ControlTemplate TargetType="{x:Type Button}">
														<Button Content="{Binding Text}"/>
													</ControlTemplate>
												</Setter.Value>
											</Setter>
										</DataTrigger>
									</Style.Triggers>
								</Style>
							</ContentPresenter.Style>
						</ContentPresenter>
					</DataTemplate>
				</ItemsControl.ItemTemplate>
			</ItemsControl>
		</Border>
	</Grid>
</UserControl>
